/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/7/14 22:43
  *
  * @file       hd_flash.c
  * @brief      Xxx hardware driver.
  *
  * @note       This file contains the hardware driver for the Xxx.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/7/14     Chris        the first version
  *
  ******************************************************************************
  */


#include "hd_flash.h"
#include <string.h>

const uint8_t dotMatrix[] = {
        0x00,0x00,0x42,0x00,0x4A,0x00,0xD2,0x1F,0x02,0x08,0x07,0x04,0xFA,0x1A,0xAA,0x13,0xAA,0x1A,0xAF,0x16,0xAA,0x1A,0xAA,0x32,0xFA,0x22,0x02,0x1E,0x00,0x00,0x00,0x00,



};

static void StorageFlash_read(Storage *this, uint8_t *buffer, uint32_t address, uint32_t count) {
    memcpy(buffer, dotMatrix, count);
}

static StorageFlash *build() {
    StorageFlash *sf = malloc(sizeof(StorageFlash));

    Driver_add(sf, GEN_PERM);

    Storage *storage = StorageBuilder.build();
    sf->storage      = *storage;
    sf->storage.read = &StorageFlash_read;

    return sf;
}

const struct StorageFlashClass StorageFlashBuilder = {.build = &build};


